// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Decoration
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
public alias 6 : SLOT_EVILNOTES

//first note is skipped for some reason

private alias 0 : Left0
private alias 1 : Down1
private alias 2 : Up2
private alias 3 : Right3

//0 = Left
//1 = Down
//2 = Up
//3 = Right
//4 = Blank


private alias object.value0 : object.timer
private alias object.value1 : Text.Line

private alias object.value2 : object.drawX
private alias object.value3 : object.drawY
private alias object.value4 : object.letterID
private alias object.value5 : object.textamount
private alias object.value6 : object.boxYpos

event ObjectMain
	temp0 = object[0].ypos
	temp0 -= 4000000

	ResetObjectEntity(6, TypeName[EvilNotes], 0, object.xpos, temp0)	

	if stage.timeEnabled == 1
		object.value7++
		if object.value7 == 12
			temp1 = object.textamount
			while temp1 > 0
			// Get the actual character at the current char pos
				GetTextInfo(object.letterID, 1, TEXTINFO_TEXTDATA, Text.Line, ArrayPos0)

				//ASCII Table required!
				switch object.letterID
				case 0	//!
					ArrayPos0++
					temp1--
					break	
				case 1
					CreateTempObject(TypeName[Evil Arrow], temp2, object.xpos, temp0)
					object[tempObjectPos].ypos += 0x999999	
					ArrayPos0++
					temp1--					
				break	
				end switch
			loop		
			Text.Line++
			object.value7 = 0
		end if
	end if
end event

event ObjectDraw
	object.drawOrder = 5

	temp0 = object[0].ypos
	temp0 -= 4000000
	
	DrawSpriteXY(0, object.xpos, temp0)
	
	// if inputdown[0].buttonC == 1
	// 	DrawSpriteXY(4, object.xpos, temp0)
	// end if

	// if inputdown[0].buttonA == 1
	// 	DrawSpriteXY(1, object.xpos, temp0)
	// end if

	// if inputdown[0].buttonY == 1
	// 	DrawSpriteXY(3, object.xpos, temp0)
	// end if

	// if inputdown[0].buttonB == 1
	// 	DrawSpriteXY(2, object.xpos, temp0)
	// end if	

	object.priority = PRIORITY_ACTIVE
end event


event ObjectStartup
	LoadSpriteSheet("3D_Test/Funkin.gif")
	SpriteFrame(0, -20, 64, 21, 1, 1)
	SpriteFrame(0, -15, 17, 12, 1, 28)	//left
	SpriteFrame(19, -18, 12, 17, 20, 25)	//doown
	SpriteFrame(33, -18, 12, 17, 34, 25)	//up	
	SpriteFrame(47, -15, 17, 12, 48, 28)	//right	
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
